This invention relates to a virtual machine system, and a technology of delivering, to an OS operating on a virtual machine, an interrupt from an I/O device.
Along with an increase in number of servers, complexity relating to operation thereof has increased, pausing a problem of an operation cost, and thus, as a technology of reducing the operation cost, server integration, which integrates a plurality of servers together into one server, has been attracting attention. As a technology for enabling the server integration, a virtual machine technology, which logically divides one computer at arbitrary ratios, is known. In the virtual machine technology, for example, firmware (or middleware) such as a hypervisor divides a physical machine into a plurality of logical partitions (LAPRs), assigns, to each LPAR, computer resources (CPUs, memories, and I/O devices), and runs, on the each LAPR, an OS. Alternatively, on one server, one host OS (OS which directly uses a physical machine) is executed, and a hypervisor operating on this host OS carries out a similar division process, thereby operating a plurality of guest OSs (OSs operating on the host OS). The virtual machine technology enables OSs conventionally operating on a plurality of servers and software operating on the OSs to operate on one server, thereby achieving the server integration.
The virtual machine technology such as the hypervisor is a technology which has been used in large computers such as mainframes. However, along with a recent increase in performance of the microprocessor, the virtual machine technology is becoming widespread in low-end servers and personal computers.
A computer such as a server employing the virtual machine technology includes a plurality of virtual machines for operating guests (general term referring to a guest OS and software programs operating on the guest OS), and virtual machine monitor (referred to as VMM hereinafter) for controlling the virtual machines.
Generally, the guest is configured such that hardware of a computer is dedicated thereto. Thus, when the server integration is realized by the virtual machine technology, it is necessary for each virtual machine to operate in the same manner as in the case in which the computer is dedicated to each guest. In order to meet this requirement, the VMM carries out emulation of a privileged instruction (instruction for operating hardware) and an interrupt, which is a notice of completion of hardware operation, contained in the guest. An overhead accompanying the emulation decreases the performance, and thus high-speed emulation is necessary.
A virtual machine includes virtual components such as a virtual CPU, virtualized physical memory, and a virtual I/O device. The VMM realizes each virtual component by assigning physical components (physical CPU, physical memory, and physical I/O device) in a dedicated or shared form. In the dedicated form, one physical component is assigned to only one virtual machine, and a part of emulator execution is unnecessary. In the shared form, a physical component is assigned to a plurality of virtual machines, and the execution of emulator is indispensable. When high performance is of primary importance, the dedicated form is used, and when high utilization efficiency of resources is of primary importance, the shared form is employed.
Conventionally, the emulator has often been implemented as software, and emulation assistance by hardware is limited to expensive computers such as mainframes. Consequently, on many computers, when a virtual machine is used, a significant overhead caused by software execution is present. However, in a computer provided with an inexpensive and widely-available x86-compatible CPU from Intel or AMD, in order to overcome the significant overhead, hardware for assisting the emulation of the virtualization feature is emerging as described below.
(1) For instruction execution by a CPU, the VT-x feature of Intel or the AMD-V feature of AMD assists the instruction execution relating to the virtualization. (2) For memory operation by the CPU, Extended Page Table (EPT) of Intel or Nested Page Table of AMD assists address translation. (3) For memory operation by an I/O device, VT-d of Intel or IOMMU of AMD assists address translation. (4) For I/O device operation by the CPU, SR-IOV of PCI-SIG assists the device operation.
With regard to assistance for the virtualization feature by hardware described above, for example, Chapter 29-3, Intel Corp., “Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3B: System Programming Guide Part 2”, September, 2008, retrieved on Oct. 1, 2008 (hereinafter, referred to as Related Art 1), describes an interrupt delivery technology using an External Interrupt Exiting feature implemented on an x68-compatible CPU. The External Interrupt Exiting is a feature to execute, upon a physical I/O device interrupt, virtualization software such as the VMM. The virtualization software enables the External Interrupt Exiting for all the CPUs and receives all interrupts from physical I/O devices. The virtualization software, which has received an interrupt, identifies the generation source of the interrupt, and, when the generation source is an I/O device assigned in the dedicated form, branches processing of a virtual CPU to an interrupt handler of the OS. When the generation source is a shared I/O device, the virtualization software executes an emulator, and branches processing of the virtual CPU to the interrupt handler of the OS.
Moreover, U.S. Pat. No. 5,109,489 (hereinafter, referred to as Related Art 2) describes an interrupt delivery technology for a general-purpose computer. In this technology, an interrupt delivered from an I/O device assigned in the dedicated form, and an interrupt delivered from an I/O device assigned in the shared form are discriminated from each other, and the interrupt delivered from an I/O device assigned in the dedicated form is directly branched to an interrupt handler of an OS without routing through virtualization software. When this feature is used, for the interrupt delivered from an I/O device assigned in the shared form, a CPU calls the virtualization software. The virtualization software sets, to the CPU, a form of assignment of the I/O device, and executes the emulator for the interrupt from the shared I/O device. Moreover, after the execution of the emulator, the virtualization software branches the processing of the virtual. CPU to the interrupt handler of the OS.